<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <title th:text="${title}"></title>
    <link rel="shortcut icon" href="favicon.ico">
    <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
    <link th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
    <!-- bootstrap-table 表格插件样式 -->
    <link th:href="@{/ajax/libs/bootstrap-table/bootstrap-table.min.css}" rel="stylesheet"/>
    <link th:href="@{/css/animate.css}" rel="stylesheet"/>
    <link th:href="@{/css/style.css?v=20200318}" rel="stylesheet"/>
    <link th:href="@{/ruoyi/css/ry-ui.css}" rel="stylesheet"/>
</head>

<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>

                        <li>
                            <label>项目类型：</label>
                            <select name="projectType"
                                    th:with="type=${@dict.getType('project_type')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                        th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <label>协议类型：</label>
                            <select name="protocolType" th:with="type=${@dict.getType('protocol_type')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                        th:value="${dict.dictValue}"></option>
                            </select>
                        </li>

                        <li>
                            <label>申报单位：</label>
                            <select name="reportUnitId" id="reportUnitId"
                                    th:with="type=${@dept.getUnit()}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.deptName}"
                                        th:value="${dict.deptId}"></option>
                            </select>
                        </li>

                        <li>
                            <label>科室：</label>
                            <select name="departmentId" id="departmentId" >
                                <option th:each="post:${dept}" th:value="${post.deptId}"
                                        th:text="${post.deptName}"></option>
                            </select>
                        </li>
                        <li class="select-time">
                            <label>开始时间：</label>
                            <input type="text" class="time-input " id="startTime" placeholder="开始时间"
                                   name="params[beginStartDate]"/>
                            <span>-</span>
                            <input type="text" class="time-input " id="endTime" placeholder="结束时间"
                                   name="params[endStartDate]"/>
                        </li>
                        <li>
                            <label>项目编号：</label>
                            <input type="text" name="contractNo"/>
                        </li>
                        <li>
                            <label>项目名称：</label>
                            <input type="text" name="contractName"/>
                        </li>
                        <li>
                            <label>高级搜索：</label>
                            <input type="text" name="searchParam"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">

        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" style="min-width: 1700px"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:contract:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:contract:remove')}]];
    var prefix = ctx + "system/contract";
    var datas_project_type = [[${@dict.getType('project_type')}]];
    var datas_protocol_type = [[${@dict.getType('protocol_type')}]];
    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            detailUrl: prefix + "/detail/{id}",
            modalName: "合同",
            columns: [
                {
                    field: 'id',
                    title: 'id',
                    visible: false
                },
                {
                    field: 'contractNo',
                    title: '项目编号'
                },
                {
                    field: 'contractName',
                    title: '项目名称'
                },
                {
                    field: 'projectType',
                    title: '项目类型',
                    formatter: function (value, item, index) {
                        return $.table.selectDictLabel(datas_project_type, item.projectType);
                    }

                },
                {
                    field: 'protocolType',
                    title: '协议类型',
                    formatter: function (value, item, index) {
                        return $.table.selectDictLabel(datas_protocol_type, item.protocolType);
                    }
                },
                {
                    field: 'agency',
                    title: '委托单位'
                },
                {
                    field: 'chargeMan',
                    title: '项目负责人'
                },
                {
                    field: 'reportUnit',
                    title: '承担部门'
                },
                {
                    field: 'startDate',
                    title: '项目开始时间'
                },
                {
                    field: 'endDate',
                    title: '项目结束时间'
                },
                {
                    field: 'contractAmount',
                    title: '合同额'
                },
                {
                    field: 'summary',
                    title: '摘要'
                },
                {
                    field: 'remark',
                    title: '备注'
                },
                {
                    field: 'totalOutlay',
                    title: '总经费'
                },
                {
                    field: 'realOutlay',
                    title: '实到经费'
                },

                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa fa-edit"></i>查看</a> ');

                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

</script>
<script type="text/javascript">


    callback = function(index, layero) {
        var iframeWin = layero.find('iframe')[0];
        iframeWin.contentWindow.submitHandler(index, layero);
    }

    $("#reportUnitId").change(function () {
        var t = $("#reportUnitId").val();
        if (t == '') {
            return;
        }

        $.ajax({
            url: ctx + 'system/dept/getDept',
            async: false,
            type: 'get',
            data: {unit: t},
            success: function (data) {
                var t3 = $("#departmentId").empty();
                t3.append("<option value=''> 所有</option>");
                for (var i = 0; i < data.length; i++) {
                    t3.append("<option value='" + data[i].deptId + "'>" + data[i].deptName + "</option>");
                }
            }
        })
    });
</script>
</body>
</html>
